<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

/**
 * 去掉回车和换行符
 */
if ( ! function_exists('trim_line_break'))
{
	function trim_line_break($str)
	{
		return str_replace(array("\r\n", "\r", "\n"), "", $str);
	}
}

/**
 * 上传文件路径编码
 */
if ( ! function_exists('encode_upload_path'))
{
    function encode_upload_path($path) {
        $pos = strpos($path, UPLOAD_DIR);
        $path = substr($path, $pos + strlen(UPLOAD_DIR) + 1);
        return str_replace('/', '_', $path);
    }
}

/**
 * 上传文件路径解码
 */
if ( ! function_exists('decode_upload_path'))
{
    function decode_upload_path($path) {
        return UPLOAD_DIR . '/' . str_replace('_', '/', $path);
    }
}